package com.example.drive.net.request

import okhttp3.FormBody
import okhttp3.Request

/**
 * POST表单上传
 */
class FormRequest constructor(
    url: String,
    tag: Any = Any(),
    private val params: Map<String, String>
) : OkHttpRequest(url, tag) {
    private val requestBody by lazy {
        FormBody.Builder().apply {
            params.forEach {
                this.add(it.key, it.value)
            }
        }.build()
    }

    override fun createRequest(): Request {
        return builder.post(requestBody).build()
    }
}